<?php defined('SYSPATH') OR die('No direct access allowed.');
$per_page = Kohana::config('forum.per_page.posts');?>
<UL class="list userposts">
	<LI class="header">
		<P class="title"><A name="top"></A><?=Kohana::lang('members.posts.title')?> (<?=Kohana::lang('members.posts.count')?> <?=$pages->total_items?>)</P>
		<?=$pages?>
	</LI>
	<?foreach($posts as $post):
	//$page = ceil($post->in_post_number/$per_page);
	$category = text::limit_chars($post->category->title, 20);
	$post_url = Router::uri('forum', array('controller'=>'post', 'method'=>$post->id));
	$cat_url = Router::uri('forum', array('controller'=>'category', 'method'=>$post->category_id));
	?>
	<LI>
		<DL class="rounded">
			<DT>
				<SPAN class="leftside ts">
					<?=cmsformat::timestamp('forum.post', $post->created)?> |
					<?=html::anchor($post_url, $post->title, array('title' => Kohana::lang('members.posts.permalink')))?> (<?=Kohana::lang('members.posts.comment_count')?>: <?=$post->comment_count?>)
				</SPAN>
				<SPAN class="rightside">
					<?=Kohana::lang('members.posts.category')?>: <?=html::anchor($cat_url, $category)?>
				</SPAN>
			</DT>
			<DD>
				<?=$post->text?>
			</DD>
		</DL>
	</LI>
	<?endforeach;?>
	<LI class="header">
		<P class="title">
			<?=html::anchor(Router::$current_uri."#top", Kohana::lang('members.posts.top'))?>
		</P>
		<?=$pages?>
	</LI>
</UL>
